package seismosurfer.gui.menu;

import javax.help.CSH;
import javax.swing.JMenu;
import javax.swing.JSeparator;

import seismosurfer.domain.Export;
import seismosurfer.gui.menuitem.ExportMenuItem;

import com.bbn.openmap.Environment;
import com.bbn.openmap.gui.AbstractOpenMapMenu;
import com.bbn.openmap.gui.menu.MapBeanPrinterMenuItem;
import com.bbn.openmap.gui.menu.QuitMenuItem;
import com.bbn.openmap.gui.menu.SaveAsMenu;

/**
 * FileMenu creates SaveAsMenu, ExportMenuItem(s), MapBeanPrinterMenuItem
 * and QuitMenuItem if not running as an applet.
 */
public class FileMenu extends AbstractOpenMapMenu {
    
    private static final long serialVersionUID = 9052474676727477188L;

    private String defaultText = "File";

    private int defaultMnemonic = 'F';

    protected JMenu exportMenu = new JMenu("Export quakes as");
    
    public FileMenu() {
        super();
        setText(defaultText);
        setMnemonic(defaultMnemonic);

        CSH.setHelpIDString(this, "fileMenu");

        if (!Environment.isApplet()) {

            add(new SaveAsMenu());

            add(new JSeparator());

            add(exportMenu);
            exportMenu.add(new ExportMenuItem("Excel CSV", Export.EXCEL_CSV));
            exportMenu.add(new ExportMenuItem("CSV", Export.CSV));
            exportMenu.add(new ExportMenuItem("TSV", Export.TSV));

            // add(new SavePropertiesMenuItem());
            // add(new LoadPropertiesMenuItem());
            // add(new JSeparator());

            add(new MapBeanPrinterMenuItem());

            add(new JSeparator());
            add(new QuitMenuItem());
        }
    }
}
